package com.example.forum.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.forum.entity.TRoles;
import com.example.forum.mapper.TRolesMapper;
import com.example.forum.service.ITRolesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author why
 * @since 2019-10-30
 */
@Service
public class TRolesServiceImpl extends ServiceImpl<TRolesMapper, TRoles> implements ITRolesService {
    @Resource
    private TRolesMapper roleMapper;
    public  String[] getMenuCheckedPermissions(String roleid) {
        List<String> list = roleMapper.getMenuCheckedPermissions(roleid);
        return (String[])list.toArray(new String[0]);
    }

    public  String[] getNormalCheckedPermissions(String roleid) {
        List<String> list = roleMapper.getNormalCheckedPermissions(roleid);
        return (String[])list.toArray(new String[0]);
    }

    public void deleteNormalPermissionsByRoleId(String roleid){
        roleMapper.deleteNormalPermissionsByRoleId(roleid);
    }

    public void deleteMenuPermissionsByRoleId(String roleid){
        roleMapper.deleteMenuPermissionsByRoleId(roleid);
    }

    public  List<Object> GetAllPermissionsForTree() {
        List<Object> list = roleMapper.GetAllPermissionsForTree();
        return list;
    };
}
